<include file="public@header"/>
</head>
<body>
<div class="wrap js-check-wrap">
    <ul class="nav nav-tabs">
        <li><a href="{:url('order/index')}">订单管理</a></li>
        <li class="active"><a href="#A" data-toggle="tab">发货</a></li>
    </ul>
    
    <div class="well form-inline margin-top-20">
        <div style="margin-left: 10%;margin-top: 20px;">
            物流单号：
            <input type="text" class="form-control" id="express_no" style="width: 250px;" value="" placeholder="请输入物流单号"><br><br>
            物流公司：
            <input type="text" class="form-control" id="express_company" style="width: 250px;" value="" placeholder="请输入物流公司名称"><br><br>
            <input type="hidden" name="" id="order_id" value="{$data.order_id}">
            <a class="btn btn-danger" href="{:url('Order/shipments')}" style="margin-left: 100px;">清空</a>&nbsp;&nbsp;&nbsp;&nbsp;
            <input type="submit" class="btn btn-primary" value="提交"  id="submit" />
        </div>
    </div>      
    



</div>
<script type="text/javascript" src="__STATIC__/js/admin.js"></script>
<script type="text/javascript">
    $("#submit").click(function(){
        var express_no = $("#express_no").val();
        var express_company = $("#express_company").val();
        var order_id = $("#order_id").val();
        if(express_no == ''){
            alert('物流单号不能为空！')
            return false;
        }
        if(express_company == ''){
            alert('物流公司不能为空！')
            return false;
        }
        $.ajax({
            type: "POST",
            url: "shipments",
            data: {"express_no":express_no,'express_company':express_company,'order_id':order_id},
            dataType: "json",
            success: function(data){
                if(data.code ==1 ){
                   alert(data.msg);
                   window.location.href="/admin/order/index"
                   return
                }else{
                    alert(data.msg);
                }
            }        
        });
    })
</script>
</body>
</html>
